package kr.hkit.powerjava.chapter22.work;

import java.util.ArrayList;

public class StudentManager {

	ArrayList<Student> arList = new ArrayList<>();

	public StudentManager(ArrayList<Student> arList) {
		this.arList = arList;
	}

	public void addStudent(Student std) {

	}

	public void delStudent(Student std) {
		if (arList.contains(std)) {
			arList.remove(arList.indexOf(std));
		} else {
			System.out.println("학생 정보 없음");
		}
	}

	public void searchStudent(Student std) {
		if (arList.contains(std)) {
			System.out.println((Student) arList.get(arList.indexOf(std)));
		} else {
			System.out.println("학생 정보 없음");
		}
	}

	public void rewrite(Student std) {
		if (arList.contains(std)) {
			arList.set(arList.indexOf(std), std);
		} else {
			System.out.println("학생 정보 없음");
		}
	}

	public void prnList() {
		for (Student std : arList) {
			System.out.println(std);
		}
	}

	public void prnHeader() {
		System.out.printf("%3s\t %5s\t %3s\t %3s\t %3s\t %3s\t %3.2s\n", "학번",
				"이름", "국어", "영어", "수학", "총점", "평균");
	}

}
